<!doctype html>
<html>
    <head>
        <!-- meta -->
        <!-- meta -->
        <title>Customizing templates</title>
        <!-- css -->
        <link href="../styles/examples.css" rel="stylesheet"/>
        <link href="../../source/styles/kendo.common.css" rel="stylesheet"/>
        <link href="../../source/styles/kendo.kendo.css" rel="stylesheet"/>
        <!-- css -->
        <!-- script -->
        <script src="../js/jquery.js"></script>
        <script src="../../source/js/kendo.core.js"></script>
        <script src="../../source/js/kendo.popup.js"></script>
        <script src="../../source/js/kendo.data.odata.js"></script>
        <script src="../../source/js/kendo.data.js"></script>
        <script src="../../source/js/kendo.list.js"></script>
        <script src="../../source/js/kendo.dropdownlist.js"></script>
        <!-- script -->
    </head>
    <body>
        <!-- nav -->
        <!-- nav -->
        <!-- description -->
        <div class="description">Customizing templates</div>
        <!-- description -->
        <div id="example" class="k-content">
            <div class="configuration">
                <span class="infoHead">Information</span>
                <p>
                    Open the DropDownList to see the customized appearance of the items.
                </p>
            </div>

            <input id="titles"/>

            <script>
                $(document).ready(function() {
                    $("#titles").kendoDropDownList({
                        dataTextField: "Name",
                        dataValueField: "Id",
                        // define custom template
                        template: '<img src="${ data.BoxArt.SmallUrl }" alt="${ data.Name }" />' +
                                  '<dl>' +
                                      '<dt>Title:</dt><dd>${ data.Name }</dd>' +
                                      '<dt>Year:</dt><dd>${ data.ReleaseYear }</dd>' +
                                  '</dl>',
                        dataSource: {
                            type: "odata",
                            serverFiltering: true,
                            filter: [{
                                field: "Name",
                                operator: "contains",
                                value: "Star Wars"
                            },{
                                field: "BoxArt.SmallUrl",
                                operator: "neq",
                                value: null
                            }],
                            transport: {
                                read: "http://odata.netflix.com/Catalog/Titles"
                            }
                        }
                    });

                    var dropdownlist = $("#titles").data("kendoDropDownList");

                    // set width of the drop-down list
                    dropdownlist.list.width(400);
                });
            </script>

            <style scoped>
                #titles-list .k-item {
                    overflow: hidden; /* clear floated images */
                }

                #titles-list img {
                    box-shadow: 0 0 4px rgba(255,255,255,.7);
                    float: left;
                    margin: 5px;
                }

                #titles-list dl {
                    margin-left: 85px;
                }

                #titles-list dt,
                #titles-list dd {
                    margin: 0;
                    padding: 0;
                }

                #titles-list dt {
                    font-weight: bold;
                    padding-top: .5em;
                }

                #titles-list dd {
                    padding-bottom: .3em;
                }
            </style>
        </div>
        <!-- tools -->
        <!-- tools -->
    </body>
</html>
